

* creating lifecom based on respondent's age. Survey was conducted in 2004. 
* communism period is 1945 to 1989 for all countries except Russia (starting 1917) and Belarus (starting 1923)

* In addition, I recoded missing values for parltrust since they messed with the regression
 replace parltrust = . if parltrust == 98
(84 real changes made, 84 to missing)

. replace parltrust = . if parltrust == 99
(364 real changes made, 364 to missing)


***lifecom**
generate lifecom    = .

replace lifecom = 3 if (age==18) 
replace lifecom = 4 if (age==19) 
replace lifecom = 5 if (age==20) 
replace lifecom = 6 if (age==21) 
replace lifecom = 7 if (age==22) 
replace lifecom = 8 if (age==23) 
replace lifecom = 9 if (age==24) 
replace lifecom = 10 if (age==25) 
replace lifecom = 11 if (age==26) 
replace lifecom = 12 if (age==27) 
replace lifecom = 13 if (age==28) 
replace lifecom = 14 if (age==29) 
replace lifecom = 15 if (age==30) 
replace lifecom = 16 if (age==31) 
replace lifecom = 17 if (age==32) 
replace lifecom = 18 if (age==33) 
replace lifecom = 19 if (age==34) 
replace lifecom = 20 if (age==35) 
replace lifecom = 21 if (age==36) 
replace lifecom = 22 if (age==37) 
replace lifecom = 23 if (age==38) 
replace lifecom = 24 if (age==39) 
replace lifecom = 25 if (age==40) 
replace lifecom = 26 if (age==41) 
replace lifecom = 27 if (age==42) 
replace lifecom = 28 if (age==43) 
replace lifecom = 29 if (age==44) 
replace lifecom = 30 if (age==45) 
replace lifecom = 31 if (age==46) 
replace lifecom = 32 if (age==47) 
replace lifecom = 33 if (age==48) 
replace lifecom = 34 if (age==49) 
replace lifecom = 35 if (age==50) 
replace lifecom = 36 if (age==51) 
replace lifecom = 37 if (age==52) 
replace lifecom = 38 if (age==53) 
replace lifecom = 39 if (age==54) 
replace lifecom = 40 if (age==55) 
replace lifecom = 41 if (age==56) 
replace lifecom = 42 if (age==57) 
replace lifecom = 43 if (age==58) 
replace lifecom = 44 if (age==59) 

replace lifecom = 44 if (age>59) & (country!= "Russia")

replace lifecom = 45 if (age==60) & (country == "Russia")
replace lifecom = 46 if (age==61) & (country == "Russia")
replace lifecom = 47 if (age==62) & (country == "Russia")
replace lifecom = 48 if (age==63) & (country == "Russia")
replace lifecom = 49 if (age==64) & (country == "Russia")
replace lifecom = 50 if (age==65) & (country == "Russia")
replace lifecom = 51 if (age==66) & (country == "Russia")
replace lifecom = 52 if (age==67) & (country == "Russia")
replace lifecom = 53 if (age==68) & (country == "Russia")
replace lifecom = 54 if (age==69) & (country == "Russia")
replace lifecom = 55 if (age==70) & (country == "Russia")
replace lifecom = 56 if (age==71) & (country == "Russia")
replace lifecom = 57 if (age==72) & (country == "Russia")
replace lifecom = 58 if (age==73) & (country == "Russia")
replace lifecom = 59 if (age==74) & (country == "Russia")
replace lifecom = 60 if (age==75) & (country == "Russia")
replace lifecom = 61 if (age==76) & (country == "Russia")
replace lifecom = 62 if (age==77) & (country == "Russia")
replace lifecom = 63 if (age==78) & (country == "Russia")
replace lifecom = 64 if (age==79) & (country == "Russia")
replace lifecom = 65 if (age==80) & (country == "Russia")
replace lifecom = 66 if (age==81) & (country == "Russia")
replace lifecom = 67 if (age==82) & (country == "Russia")
replace lifecom = 68 if (age==83) & (country == "Russia")
replace lifecom = 69 if (age==84) & (country == "Russia")
replace lifecom = 70 if (age==85) & (country == "Russia")
replace lifecom = 71 if (age==86) & (country == "Russia")
replace lifecom = 72 if (age==87) & (country == "Russia")
replace lifecom = 73 if (age==88) & (country == "Russia")
replace lifecom = 74 if (age==89) & (country == "Russia")
replace lifecom = 75 if (age==90) & (country == "Russia")
replace lifecom = 76 if (age==91) & (country == "Russia")
replace lifecom = 77 if (age==92) & (country == "Russia")
replace lifecom = 78 if (age==93) & (country == "Russia")
replace lifecom = 79 if (age==94) & (country == "Russia")
replace lifecom = 80 if (age==95) & (country == "Russia")
replace lifecom = 81 if (age==96) & (country == "Russia")

replace lifecom = 45 if (age==60) & (country == "Belorus")
replace lifecom = 46 if (age==61) & (country == "Belorus")
replace lifecom = 47 if (age==62) & (country == "Belorus")
replace lifecom = 48 if (age==63) & (country == "Belorus")
replace lifecom = 49 if (age==64) & (country == "Belorus")
replace lifecom = 50 if (age==65) & (country == "Belorus")
replace lifecom = 51 if (age==66) & (country == "Belorus")
replace lifecom = 52 if (age==67) & (country == "Belorus")
replace lifecom = 53 if (age==68) & (country == "Belorus")
replace lifecom = 54 if (age==69) & (country == "Belorus")
replace lifecom = 55 if (age==70) & (country == "Belorus")
replace lifecom = 56 if (age==71) & (country == "Belorus")
replace lifecom = 57 if (age==72) & (country == "Belorus")
replace lifecom = 58 if (age==73) & (country == "Belorus")
replace lifecom = 59 if (age==74) & (country == "Belorus")
replace lifecom = 60 if (age==75) & (country == "Belorus")
replace lifecom = 61 if (age==76) & (country == "Belorus")
replace lifecom = 62 if (age==77) & (country == "Belorus")
replace lifecom = 63 if (age==78) & (country == "Belorus")
replace lifecom = 64 if (age==79) & (country == "Belorus")
replace lifecom = 65 if (age==80) & (country == "Belorus")
replace lifecom = 66 if (age==81) & (country == "Belorus")

***winner***

generate winner    = .
replace winner = 0
replace winner =1 if g6bel==1
replace winner =1 if (g6bul==8) | (g6bul==9)
replace winner =1 if (g6cze== 4) |(g6cze==7) | (g6cze==8)
replace winner =1 if (g6est ==3) |(g6est ==5) |(g6est ==9)
replace winner =1 if (g6hun==1)| (g6hun==3)
replace winner =1 if (g6lat==1) | (g6lat==5) | (g6lat==6) | (g6lat==7)
replace winner =1 if (g6lit==5)| (g6lit==6)
replace winner =1 if (g6pol==16)| (g6pol==18)
replace winner =1 if g6rom==1
replace winner =1 if g6rus==14
replace winner =1 if (g6sle==1)| (g6sle==4)| (g6sle==7)
replace winner =1 if (g6svk==1) |(g6svk==2) | (g6svk==4) |(g6svk==10) | (g6svk==14)

* In addition, I recoded religiosity, pescom and pesny since they are in the wrong direction 
recode  pescom (1=5)  (2=4) (3=3) (4=2) (5=1) 
label define pes 1 "much worse" 2 "somewhat worse" 3 "same" 4 "somewhat better" 5 "much better" 
label value pescom pes

recode  pesny (1=5)  (2=4) (3=3) (4=2) (5=1) 
label define pes 1 "much worse" 2 "somewhat worse" 3 "same" 4 "somewhat better" 5 "much better" 
label value pesny pes


recode  religiosity (1=6)  (2=5) (3=4) (4=3) (5=2) (6=1)
label define relig 1 "never" 2 "less than once/year " 3 " once a year" 4 " several times/year" 5 "1-2 times/month" 6 "once a week" 
label value religiosity relig





              